import request from '@/utils/request'
// 用户登录
export function login(data) {
  return request({
    url: 'user/Login?userId=' + data.username + '&password=' + data.password,
    method: 'post'
  })
}
// 根据token获取用户信息
export function getInfo(token) {
  return request({
    url: 'user/info',
    method: 'get',
    params: { token }
  })
}
// 无意义注销接口
export function logout() {
  return request({
    url: 'http://192.144.184.65:8080/alumnus/api/user/logout',
    method: 'get'
  })
}
// 获取所有用户信息
export function getAllUserInfo() {
  return request({
    url: 'user/selectAllInfo',
    method: 'get'
  })
}
// 根据userId获取用户详细信息
export function showUserInfoById(userId) {
  return request({
    url: 'user/select?userId=' + userId,
    method: 'get'
  })
}
// 添加用户信息
export function addUser(userId, userClassName, userEmail, userLevel, userName, userOrigin, userPartName, userPhone, userSex, userOldStatus, userPwd, userStatus, userType) {
  console.log('传过来的userOldStatus为', userOldStatus)
  return request({
    url: 'user/addManagerUser?userId=' + userId + '&userInfo.userClassName=' + userClassName + '&userInfo.userEmail=' + userEmail + '&userInfo.userId=' + userId + '&userInfo.userLevel=' + userLevel + '&userInfo.userName=' + userName + '&userInfo.userOrigin=' + userOrigin + '&userInfo.userPartName=' + userPartName + '&userInfo.userPhone=' + userPhone + '&userInfo.userSex=' + userSex + '&userOldStatus=2' + '&userPwd=' + userPwd + '&userStatus=' + userStatus + '&userType=' + userType,
    method: 'post'
  })
}
// 更新用户信息
export function updateUser(user_id, user_pwd) {
  return request({
    url: 'user/changePwd?user_id=' + user_id + '&user_pwd=' + user_pwd,
    method: 'put'
  })
}
